-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add createdTime
field to SessionInformation
#17513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Date currentDate = new Date(); | ||
this.sessionIds.put(sessionId, new SessionInformation(principal, sessionId, new Date(currentDate.getTime()), | ||
new Date(currentDate.getTime()))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's okay, since we wouldn't want to have a link to the same Date?
public SessionInformation(Object principal, String sessionId, Date lastRequest, Date createdTime) { | ||
Assert.notNull(principal, "Principal required"); | ||
Assert.hasText(sessionId, "SessionId required"); | ||
Assert.notNull(lastRequest, "LastRequest required"); | ||
Assert.notNull(lastRequest, "CreatedTime required"); | ||
this.principal = principal; | ||
this.sessionId = sessionId; | ||
this.lastRequest = lastRequest; | ||
this.createdTime = createdTime; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that SessionInformation
is created in SessionRegistry
, so we don't need to maintain backward compatibility, right?
528743d
to
7141e7a
Compare
Closes: spring-projectsgh-17359 Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
public OidcSessionInformation(String sessionId, Map<String, String> authorities, OidcUser user) { | ||
super(user, sessionId, new Date()); | ||
this(sessionId, authorities, user, new Date()); | ||
} | ||
|
||
private OidcSessionInformation(String sessionId, Map<String, String> authorities, OidcUser user, Date now) { | ||
super(user, sessionId, new Date(now.getTime()), new Date(now.getTime())); | ||
this.authorities = (authorities != null) ? new LinkedHashMap<>(authorities) : Collections.emptyMap(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only way to solve the problem I wrote about here #17513 (comment)
Closes: gh-17359